<?php 
define('PAGE_NEED_PRI','PRI_EDIT');
session_start();
include("main.php");
include("blog-main-page-function.php");
?>

<?php
	if(!isset($_REQUEST['articleID']))
		exit("Please specify acticle id.");
	$articleID = intval($_REQUEST['articleID']);
	$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
	switch($action )
	{
		case 'del':
			delete_row_block();
			break;
		case 'save':
			save_block();
		break;
		case 'ajax_set_style':
			$query = sprintf("UPDATE `news` SET `sub_page_show_style`='%s' WHERE `id`=%d",mysql_real_escape_string($_REQUEST['style']),$articleID);
			$result = mysql_query($query);
			if($result !== false)
			{
				echo "ok";
			}
			exit();
		break;
	}
	$articleInfo = get_article_info($articleID);
	$page_list = get_aricle_pages($articleID);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control2.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.5.2.min.js"  language="javascript" ></script>
</head>

<body>

<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
 <?php include_once('top_btn.php');?>
 <?php include_once('blog-main-page-btn.php');?>
  <div id="contact-add"><!--start contact //-->

<div class="contact-add-line">
文章標題：<input name="title" type="text" class="contact_add-tit-keyin" value="<?php echo $articleInfo['title'];?>"  />
</div>
<?php if($articleInfo['lb'] == '4'):?>
<script language="javascript">
	$(function(){
		//init select
		$("input[type=radio][name=sub_page_show_style][value=<?php echo $articleInfo['sub_page_show_style'];?>]").attr("checked",'checked'); 
		
		$("input[type=radio][name=sub_page_show_style]").bind('click',function(){
			$.get('?articleID=<?php echo $articleID;?>&action=ajax_set_style&style='+$(this).val(),function(data){
				alert("修改分頁方式成功！");
			});
		});
	});
	
</script>
<div class="contact-add-line">
分頁方式：<input type="radio" name="sub_page_show_style"  value="onepage"/>不分頁&nbsp;&nbsp;<input type="radio" name="sub_page_show_style" value="split"/>分頁
</div>
<?php endif;?>
<?php foreach($page_list as $pageInfo):?>
	<div class="contact-add-line">
	分頁內容：<br />
	<?php echo $pageInfo['content'];?>
	<ul>
	<li><a href="blog-main-page-edit.php?articleID=<?php echo $articleID;?>&id=<?php echo $pageInfo['id'];?>">編輯分頁</a></li>
	 <li><a href="?articleID=<?php echo $articleID;?>&id=<?php echo $pageInfo['id'];?>&action=del">刪除分頁</a></li>
	 </ul>
	</div>
<?php endforeach;?>

  </div><!--end contact //-->
</div><!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
<?php include_once('botton_btn.php');?>
</div>
</body>
</html>
